#include <cstdio>
#include <memory.h>
#include <cstring>

const int maxn = 805000 ;
int wa[maxn], wb[maxn], wv[maxn], ws[maxn], rank[maxn], height[maxn], sa[maxn], s[maxn];
int l[ maxn ];
char ans[ 201 ];

int cmp(int *r,int a,int b,int l){
    return r[a]==r[b] && r[a+l]==r[b+l] ;
}

void da(int *r, int n, int m){
    int i, j, p, *x = wa, *y = wb, *t ;
    for(i=0; i<m; i++) ws[i] = 0 ;
    for(i=0; i<n; i++) ws[x[i]=r[i]] ++ ;
    for(i=1; i<m; i++) ws[i] += ws[i-1] ;
    for(i=n-1; i>=0; i--) sa[--ws[x[i]]] = i ;
    for(j=1,p=1; p<n; j*=2, m=p){
        for(p=0,i=n-j; i<n; i++) y[p++] = i ;
        for(i=0; i<n; i++) if(sa[i]>=j) y[p++] = sa[i] - j ;
        for(i=0; i<n; i++) wv[i] = x[y[i]] ;
        for(i=0; i<m; i++) ws[i] = 0 ;
        for(i=0; i<n; i++) ws[wv[i]] ++ ;
        for(i=1; i<m; i++) ws[i] += ws[i-1] ;
        for(i=n-1; i>=0; i--) sa[--ws[wv[i]]] = y[i] ;
        for(t=x, x=y, y=t, p=1, x[sa[0]]=0, i=1; i<n; i++)
        x[sa[i]] = cmp(y, sa[i-1], sa[i], j) ? p - 1 : p ++ ;
    }
    return ;
}

void calheight(int *r, int n){
    int i, j, k = 0 ;
    for(i=1; i<=n; i++) rank[sa[i]] = i;
    for(i=0; i<n; height[rank[i++]]=k)
        for(k?k--:0, j=sa[rank[i]-1]; r[i+k]==r[j+k]; k++) ;
    return ;
}

int n, len;

void init( )
{
    int i, j, t = 27;
    char str[ 201 ];
    len = 0;
    for ( i = 0; i < n; i++ )
    {
        scanf("%s", str);
        for ( j = 0; j < strlen( str ); j++ )
        {
            s[ len ] = str[ j ] - 'a' + 1;
            l[ len++ ] = i;
        }
        s[ len ] = t;
        l[ len++ ] = t++;
    }
    s[ len ] = 0;
    da( s, len + 1, t );
    calheight( s, len );
}

bool check( int m )
{
    int i, j, cnt = 0;
    bool visit[ 4001 ];
    memset( visit, 0, sizeof( visit ) );
    for ( i = 2; i <= len; i++ )
    {
        if ( height[ i ] < m )
        {
            memset( visit, 0, sizeof( visit ) );
            cnt = 0;
            continue;
        }
        if ( !visit[ l[ sa[ i - 1 ] ] ])
        {
            visit[ l[ sa[ i - 1 ] ] ] = true;
            cnt++;
        }
        if ( !visit[ l[ sa[ i ] ] ])
        {
            visit[ l[ sa[ i ] ] ] = true;
            cnt++;
        }
        if ( cnt == n )
        {
            for ( j = 0; j < m; j++ )
                ans[ j ] = s[ sa[ i ] + j ] + 'a' - 1;
            ans[ j ] = 0;
            return true;
        }
    }
    return false;
}

void work( )
{
    int left = 1, right = 200, mid;
    bool flag = false;
    while ( left < right )
    {
        mid = ( left + right ) / 2;
        if ( check( mid ) )
        {
            flag = true;
            left = mid + 1;
        }
        else
            right = mid;
    }
    if ( flag )
        printf("%s\n", ans);
    else
        puts("IDENTITY LOST");
}

int main( )
{
    while ( scanf("%d", &n) && n )
    {
        init( );
        work( );
    }
    return 0;
}
